import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsEmail, IsNotEmpty } from "class-validator";
import { PageDto } from "src/common/dto/dto";
import { Status } from "src/dictionaries/index.enum";
import { FindOperator } from "typeorm";

/*
 * @Description: 
 * @Author: fhw
 * @Date: 2023-03-27 15:31:57
 */

export class GetUserPage extends PageDto {
  @ApiPropertyOptional({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id?: number;

  @ApiPropertyOptional({
    type: Number,
    name: 'coupleId',
    description: '情侣关系',
  })
  public readonly coupleId?: number;

  @ApiPropertyOptional({
    type: String,
    name: 'email',
    description: '邮箱',
  })
  public readonly email?: string;

  @ApiPropertyOptional({
    type: String,
    name: 'mobile',
    description: '电话号码',
  })
  public readonly mobile?: string;

  @ApiPropertyOptional({
    type: String,
    name: 'gender',
    description: '性别',
    enum: [1, 2]
  })
  public readonly gender?: string;

  @ApiPropertyOptional({
    type: String,
    name: 'username',
    description: '用户名',
  })
  public readonly username?: FindOperator<string>;
  @ApiPropertyOptional({
    type: String,
    name: 'status',
    description: '是否禁用账号状态',
    enum: Status,
  })
  public readonly status?: Status;
}


/** 修改密码 */
export class UpdatePassWordDto {
  @IsNotEmpty({ message: '登录密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'old_password',
    description: '登录密码',
  })
  public readonly old_password: string;

  @IsNotEmpty({ message: '新密码不能为空' })
  @ApiProperty({
    type: String,
    name: 'new_password',
    description: '新密码',
  })
  public readonly new_password: string;
}
/** 获取用户信息 */
export class GetUserInfoDto {
  @ApiPropertyOptional({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id?: number;

  @ApiPropertyOptional({
    type: String,
    name: 'mobile',
    description: '手机号',
  })
  public readonly mobile?: string;
}
export class UpdateUserInfoDto {
  @IsNotEmpty({ message: '用户昵称不能为空' })
  @ApiProperty({
    type: String,
    name: 'username',
    description: '用户昵称',
  })
  public readonly username: string;
  @ApiPropertyOptional({
    type: String,
    name: 'mobile',
    description: '电话号码',
  })
  public readonly mobile: string;
  @ApiPropertyOptional({
    type: String,
    name: 'QQ',
    description: 'QQ',
  })
  public readonly QQ: string;
  @ApiPropertyOptional({
    type: String,
    name: 'description',
    description: '个人介绍',
  })
  public readonly description: string;
  @ApiPropertyOptional({
    type: String,
    name: 'birthdayDate',
    description: '生日字段',
  })
  public readonly birthdayDate: string;
  @ApiPropertyOptional({
    type: String,
    name: 'avatar',
    description: '头像',
  })
  public readonly avatar: string;

  @ApiPropertyOptional({
    type: String,
    name: 'gender',
    description: '性别',
    enum: [1, 2]
  })
  public readonly gender?: string;

}